<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Others Commands</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="5">Others Commands</font></b></p>

<br><b>语法</b><blockquote><pre><font face="Courier New, Courier, mono"size="2">
<b><font color="#3A3966">Goto</font></b> &lt;label&gt;
</font></pre></blockquote>
<b>概要</b><br><blockquote>





This command is used to transfer the program directly to the labels position. Be cautious when using 
this function, as incorrect use could cause a program to crash... <br>
<br>
Note: To exit a loop safely, you always should use <a href="break_continue.html">Break</a> instead of <b><font color="#3A3966">Goto</font></b>. 


 


</blockquote>
<br><b>语法</b><blockquote><pre><font face="Courier New, Courier, mono"size="2">
<b><font color="#3A3966">End</font></b> [ExitCode]
</font></pre></blockquote>
<b>概要</b><br><blockquote>





Ends the program execution correctly. The 'ExitCode' optional parameter can be specified if the 
program need to returns an error code (widely used in console programs). 
<br>
<br>
The 'ExitCode' can be further used e.g. with the <a href="../process/programexitcode.html">ProgramExitCode()</a> command. 


 


</blockquote>
<br><b>语法</b><blockquote><pre><font face="Courier New, Courier, mono"size="2">
<b><font color="#3A3966">Swap</font></b> &lt;expression&gt;, &lt;expression&gt;
</font></pre></blockquote>
<b>概要</b><br><blockquote>





Swaps the value of the both expression, in an optimized way. The both &lt;expression&gt; have to be 
a <a href="variables.html">variable</a>, <a href="dim.html">array</a>, <a href="newlist.html">list</a> or a  <a href="newmap.html">map</a> 
element (structured or not) and have to be one of the 
PureBasic native type like long (.l), quad (.q), string etc. 

 

</blockquote><p><b>Example:</b> Swapping of strings</p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  Hello$ = "Hello"
  World$ = "World"
  
  <b><font color="#3A3966">Swap</font></b> Hello$, World$
  
  <b><font color="#3A3966">Debug</font></b> Hello$+" "+World$
</font></pre>

</blockquote><p><b>Example:</b> Swapping of multi-dimensional arrays elements</p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">Dim</font></b> <font color="#3A3966">Array1</font>(5,5)
  <b><font color="#3A3966">Dim</font></b> <font color="#3A3966">Array2</font>(5,5) 
<font color="#3A3966">  Array1</font>(2,2) = 10     <font color="#3A3966">; set initial contents</font>
<font color="#3A3966">  Array2</font>(3,3) = 20
  
  <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">Array1</font>(2,2) <font color="#3A3966">; will print 10</font>
  <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">Array2</font>(3,3) <font color="#3A3966">; will print 20</font>
  
  <b><font color="#3A3966">Swap</font></b> <font color="#3A3966">Array1</font>(2,2) ,<font color="#3A3966"> Array2</font>(3,3)  <font color="#3A3966">; swap 2 arrays elements</font>
  
  <b><font color="#3A3966">Debug</font></b> "Array contents after swapping:"
  <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">Array1</font>(2,2)    <font color="#3A3966">; will print 20</font>
  <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">Array2</font>(3,3)    <font color="#3A3966">; will print 10</font>
</font></pre>
</body></html>